//
//  ReadMainModel.m
//  product_B
//
//  Created by lanou on 16/5/28.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "ReadMainModel.h"
#import "ReadserialModel.h"
#import "ReadQuestionModel.h"
@implementation ReadMainModel
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}
+ (NSMutableArray *)readMainModelWithConfigure:(NSDictionary *)dic{
    NSMutableArray *modelArray = [NSMutableArray array];
    NSMutableArray *essay = [NSMutableArray array];
    NSMutableArray *question = [NSMutableArray array];
    NSMutableArray *serial = [NSMutableArray array];
    NSArray *essayArray = dic[@"data"][@"essay"];
    NSArray *questionArray = dic[@"data"][@"question"];
    NSArray *serialArray = dic[@"data"][@"serial"];
    for (NSDictionary *dic  in essayArray) {
        ReadMainModel *model = [[ReadMainModel alloc]init];
        [model setValuesForKeysWithDictionary:dic];
        [essay addObject:model];
    }
    for (NSDictionary *dic  in questionArray) {
        ReadQuestionModel *model = [[ReadQuestionModel alloc]init];
        [model setValuesForKeysWithDictionary:dic];
        [question addObject:model];
    }
    for (NSDictionary *dic  in serialArray) {
        ReadserialModel *model = [[ReadserialModel alloc]init];
        [model setValuesForKeysWithDictionary:dic];
        [serial addObject:model];
    }
    for (int i = 0; i<10; i++) {
        NSMutableArray *array = [NSMutableArray array];
        ReadMainModel *model1 = essay[i];
        ReadserialModel *model2 = serial[i];
        ReadQuestionModel *model3 = question[i];
        [array addObject:model1];
        [array addObject:model2];
        [array addObject:model3];
        [modelArray addObject:array];
    }
    return modelArray;
}
+ (NSMutableArray *)readMainModelArrayWithConfigure:(NSDictionary *)dic{
    NSMutableArray *modelArray = [NSMutableArray array];
    NSMutableArray *essay = [NSMutableArray array];
    NSMutableArray *question = [NSMutableArray array];
    NSMutableArray *serial = [NSMutableArray array];
    NSArray *essayArray = dic[@"data"][@"essay"];
    NSArray *questionArray = dic[@"data"][@"question"];
    NSArray *serialArray = dic[@"data"][@"serial"];
    for (NSDictionary *dic  in essayArray) {
        ReadMainModel *model = [[ReadMainModel alloc]init];
        [model setValuesForKeysWithDictionary:dic];
        [essay addObject:model];
    }
    for (NSDictionary *dic  in questionArray) {
        ReadQuestionModel *model = [[ReadQuestionModel alloc]init];
        [model setValuesForKeysWithDictionary:dic];
        [question addObject:model];
    }
    for (NSDictionary *dic  in serialArray) {
        ReadserialModel *model = [[ReadserialModel alloc]init];
        [model setValuesForKeysWithDictionary:dic];
        [serial addObject:model];
    }
    [modelArray addObject:essay];
    [modelArray addObject:serial];
    [modelArray addObject:question];
    return modelArray;
}


+ (NSMutableArray *)readDetailModelWithConfigure:(NSDictionary *)dic{
    NSMutableArray *modelArray = [NSMutableArray array];
    NSArray *dataArray = dic[@"data"];
    for (NSDictionary *dic  in dataArray) {
        ReadMainModel *model = [[ReadMainModel alloc]init];
        [model setValuesForKeysWithDictionary:dic];
        [modelArray addObject:model];
    }
    return modelArray;
}
@end
